from rest_framework import serializers
from pets import models


class PetTypeSerializer(serializers.ModelSerializer):

    class Meta:
        model = models.PetType
        fields = '__all__'
        read_only_fields = ('id', )


class PetClsSerializer(serializers.ModelSerializer):

    class Meta:
        model = models.PetCls
        fields = ['id', 'name', 'path']
        read_only_fields = ('id', )


class PetImgSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.PetImg
        fields = '__all__'
        read_only_fields = ('id',)


class UploadImgSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.UploadImg
        fields = '__all__'
        read_only_fields = ('id',)


class LogsSerializer(serializers.ModelSerializer):
    img_path = serializers.CharField(source='im.n_path', required=False)
    class Meta:
        model = models.Logs
        fields = ['id', 'result', 'timer', 'ip', 'img_path']
        read_only_fields = ('id',)


